/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package luft27.comm.dozor;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;

/**
 *
 * @author amalikov
 */
public class ManualControlAck implements MessagePayload{
	public short roll;
	public short pitch;
	public short heading;
	public short ias;
	public short baroAlt;
	public short vs;
	public short directAlt;

	@Override
	public byte[] get() {
		ByteBuffer bb = ByteBuffer.allocate(256).order(ByteOrder.LITTLE_ENDIAN);
		bb.putShort(roll);
		bb.putShort(pitch);
		bb.putShort(heading);
		bb.putShort(ias);
		bb.putShort(baroAlt);
		bb.putShort(vs);
		bb.putShort(directAlt);
		return Arrays.copyOf(bb.array(), bb.position());
	}

	@Override
	public void set(byte[] data) {
		ByteBuffer bb = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
		roll = bb.getShort();
		pitch = bb.getShort();
		heading = bb.getShort();
		ias = bb.getShort();
		baroAlt = bb.getShort();
		vs = bb.getShort();
		directAlt = bb.getShort();
	}
	
}
